<template>
    <div>详情页
        <ul>
            <li>标题:{{info.title}}</li>
            <li>标题:{{info.content}}</li>
        </ul>
        <a @click="go">返回</a>
        
    </div>
</template>
<script setup>
import {onMounted,ref} from "vue"
import {useRoute,useRouter} from "vue-router"
import axios from "axios"
const route=useRoute()
const router=useRouter()
onMounted(()=>{
    console.log(route.query)
    getdetail(route.query.id)
})

let info=ref({})

const getdetail=(id)=>{
    axios.get(`http://127.0.0.1:8000/api/show/?id=${id}`).then(res=>{
        console.log(res)
        info.value=res.data.data
    })
}
const go=()=>{
    router.push("/news")
}

</script>